#include "Model.h"

Model::Model(sgm::Geometry *model, CGparameter matrixParam)
{
	this ->matrixParam = matrixParam;
	meshesCount = model ->meshesCount;
	meshes = new Mesh * [model ->meshesCount];

	for (int i = 0; i < model ->meshesCount; i++)
		meshes[i] = new Mesh(model ->meshes[i], matrixParam);
}

void Model::AssignMaterials(MaterialsCollection *matColl)
{
	for (int i = 0; i < meshesCount; i++)
		meshes[i] ->SetMaterial((*matColl)[meshes[i] ->mesh ->materialIndex]);
}

void Model::Process(float ms)
{
}

void Model::Render()
{
	for (int i = 0; i < meshesCount; i++)
		meshes[i] ->Render();
}

Mesh ** Model::GetMeshes()
{
	return meshes;
}

int Model::GetMeshCount()
{
	return meshesCount;
}
